#include "GenerateGraph.h"

#include <boost/random/uniform_real.hpp>
#include <boost/random/uniform_int.hpp>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/variate_generator.hpp>

void GenerateGraph(float* ip_graph,
                   size_t i_edges,
                   size_t i_filling,
                   size_t i_max)
  {
  boost::mt19937 rng;
  boost::uniform_real<float> edge_eng(0, i_max);
  boost::uniform_int<> filling_eng(0, 100);
  boost::variate_generator<boost::mt19937&, boost::uniform_real<float> > edge_gen(rng, edge_eng);
  boost::variate_generator<boost::mt19937&, boost::uniform_int<> > filling_gen(rng, filling_eng);

  for(size_t i = 0; i < i_edges; ++i)
    for (size_t j = 0; j < i_edges; ++j)
      if(i!=j && filling_gen() < i_filling)
        ip_graph[i*i_edges+j] = edge_gen();
      else        
        ip_graph[i*i_edges+j] = -1;
  }